BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Discourse//<%= Discourse.current_hostname %>//<%= Discourse.full_version %>//EN
<% @events.each do |event| %>
BEGIN:VEVENT
UID:bookmark_reminder_#<%= event.id %>@<%= Discourse.current_hostname %>
DTSTAMP:<%= Time.now.utc.strftime("%Y%m%dT%H%M%SZ") %>
DTSTART:<%= event.starts_at.strftime("%Y%m%dT%H%M%SZ") %>
DTEND:<%= event.ends_at.presence ? event.ends_at.strftime("%Y%m%dT%H%M%SZ") : (event.starts_at + 1.hour).strftime("%Y%m%dT%H%M%SZ") %>
SUMMARY:<%= event.name.presence || event.post.topic.title %>
DESCRIPTION:<%= PrettyText.format_for_email(event.post.excerpt, event.post).html_safe %>
URL:<%= Discourse.base_url %>/t/-/<%= event.post.topic_id %>/<%= event.post.post_number %>
END:VEVENT
<% end %>
END:VCALENDAR
